From 4b5f51fb09bd44c4dbb732b0fa0d480b470a196d Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 7 Sep 2004 19:34:03 +0000 Subject: [PATCH] From John Hay So here is a patch to make the track output function use the DM format and to fix the header to also claim that. I decided on DM because by far most examples I could find used it. --- gpsbabel/pcx.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gpsbabel/pcx.c b/gpsbabel/pcx.c index a00bb096b..c1cf53197 100644 --- a/gpsbabel/pcx.c +++ b/gpsbabel/pcx.c @@ -217,18 +217,26 @@ pcx_track_hdr(const route_head *trk) void pcx_track_disp(const waypoint *wpt) { + double lon,lat; char tbuf[100]; struct tm *tm; char *tp; + lon = degrees2ddmm(wpt->longitude); + lat = degrees2ddmm(wpt->latitude); + tm = localtime(&wpt->creation_time); strftime(tbuf, sizeof(tbuf), "%d-%b-%y %T", tm); for (tp = tbuf; *tp; tp++) { *tp = toupper(*tp); } - fprintf(file_out, "T %+011.7f %+012.7f %s %.f\n", - wpt->latitude, wpt->longitude, tbuf, wpt->altitude); + fprintf(file_out, "T %c%08.5f %c%011.5f %s %.f\n", + lat < 0.0 ? 'S' : 'N', + fabs(lat), + lon < 0.0 ? 'W' : 'E', + fabs(lon), + tbuf, wpt->altitude); } @@ -243,7 +251,7 @@ fprintf(file_out, "M G WGS 84 121 +0.000000e+00 +0.000000e+00 +0.000000e+00 +0.000000e+00 +0.000000e+00\n" "\n" "H COORDINATE SYSTEM\n" -"U LAT LON DEG\n" +"U LAT LON DM\n" "\n" "H IDNT LATITUDE LONGITUDE DATE TIME ALT DESCRIPTION PROXIMITY SYMBOL ;waypts\n"); setshort_length(mkshort_handle, 6); -- 2.30.2